﻿using System;
using System.Collections.Generic;
using System.Text;

namespace RaisingStudio.Data.Common
{
    /// <summary>
    /// datatable definition.
    /// </summary>
    [Serializable]
    public class DataTableDefinition
    {
        private string tableName;
        /// <summary>
        /// table name.
        /// </summary>
        public string TableName
        {
            get 
            {
                return this.tableName;
            }
            set
            {
                this.tableName = value;
            }
        }

        private string sourceName;
        /// <summary>
        /// The name in database.
        /// </summary>
        public string SourceName
        {
            get 
            {
                return this.sourceName;
            }
            set
            {
                this.sourceName = value;
            }
        }

        private List<string> primaryKeys = new List<string>();
        /// <summary>
        /// primary key.
        /// </summary>
        public List<string> PrimaryKeys
        {
            get
            {
                return this.primaryKeys;
            }
        }

        private Dictionary<string, DataColumnDefinition> columns = new Dictionary<string, DataColumnDefinition>();
        /// <summary>
        /// column definition.
        /// </summary>
        public Dictionary<string, DataColumnDefinition> Columns
        {
            get
            {
                return this.columns;
            }
        }

        #region Constructor
        /// <summary>
        /// Constructor
        /// </summary>
        public DataTableDefinition()
        {
        }

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="tableName">table name.</param>
        /// <param name="sourceName">The name in database.</param>
        public DataTableDefinition(string tableName, string sourceName)
        {
            this.tableName = tableName;
            this.sourceName = sourceName;
        }
        #endregion

        private DataTableDefinition includeDefinition;
        /// <summary>
        /// has datatable definition.
        /// </summary>
        public DataTableDefinition IncludeDefinition
        {
            get
            {
                return this.includeDefinition;
            }
            set
            {
                this.includeDefinition = value;
            }
        }
    }
}
